{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
          <div class="col-md-12">
              <div class="box box-info">
                <div class="box-header with-border">
                  <h3 class="box-title">学校基础信息设置</h3>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                <form class="form-horizontal" method="post">
                  <div class="box-body">
                        <div class="form-group">
                          <label class="col-sm-2 control-label">学校名称</label>
                          <div class="col-sm-6">
                            <input type="text" class="form-control" id="inputEmail3" name="baseset_name" value="{%$baseset_data.baseset_name%}">
                          </div>
                        </div>
						<div class="form-group">
                          <label  class="col-sm-2 control-label">学校简称</label>
                          <div class="col-sm-6">
                            <input type="text" class="form-control" name="baseset_ename" value="{%$baseset_data.baseset_ename%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">英文名称</label>
                          <div class="col-sm-6">
                            <input type="text" class="form-control" name="baseset_english" value="{%$baseset_data.baseset_english%}">
                          </div>
                        </div>
						<div class="form-group">
                          <label  class="col-sm-2 control-label">学校简介</label>
                          <div class="col-sm-6">
                            <textarea class="form-control" rows="3" name="baseset_introduce" value="">{%$baseset_data.baseset_introduce%}</textarea>
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">学校代码</label>
                          <div class="col-sm-6">		
                            <input type="text" class="form-control" name="baseset_code" value="{%$baseset_data.baseset_code%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">学校类型</label>
                          <div class="col-sm-6">
                             <select class="form-control" name="baseset_type">
                                <option value="1"> 小学</option>
                                <option value="2"> 初中</option>
                                <option value="3"> 高中</option>
                                <option value="0"> 完中</option>
                              </select>
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">地区类别</label>
                          <div class="col-sm-6">
                            <select class="form-control" name="baseset_area">
                                <option value="1"> 城</option>
                                <option value="2"> 乡</option>
                                <option value="0"> 城乡结合</option>
                              </select>
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">地址</label>
                          <div class="col-sm-2">                         
                              <select id="seachprov" name="baseset_province" onChange="changeComplexProvince(this.value, sub_array, 'seachcity', 'seachdistrict');" class="form-control"></select>                        
                          </div>
                          <div class="col-sm-2">
                            <select id="seachcity" name="baseset_city" onChange="changeCity(this.value,'seachdistrict','seachdistrict');"  class="form-control"></select>
                          </div>
                          <div class="col-sm-2">
                              <select id="seachdistrict" name="baseset_district" class="form-control"></select>
                          </div>
                        </div>
                        <div class="form-group">
                            <label  class="col-sm-2 control-label">详细地址</label>
                            <div class="col-sm-6">
                               <input type="text" class="form-control" name="baseset_addr" value="{%$baseset_data.baseset_addr%}">  
                             </div>
                        </div>
                       <!--后面添加-->
                        <div class="form-group">
                            <label  class="col-sm-2 control-label">年级数量</label>
                            <div class="col-sm-2">
                               <input type="text" class="form-control" name="baseset_gradenum" value="{%$baseset_data.baseset_gradenum%}" id="nian">  
                             </div>
                             <a class="btn btn-default tong1"> 统 计</a>
                        </div>
                        <div class="form-group">
                            <label  class="col-sm-2 control-label">班级数量</label>
                            <div class="col-sm-2">
                               <input type="text" class="form-control" name="baseset_classnum" value="{%$baseset_data.baseset_classnum%}" id="ban">  
                             </div>
                             <a class="btn btn-default tong2"> 统 计</a>
                        </div>
                        <div class="form-group">
                            <label  class="col-sm-2 control-label">教师人数</label>
                            <div class="col-sm-2">
                               <input type="text" class="form-control" name="baseset_staffnum" value="{%$baseset_data.baseset_staffnum%}" id="jiao">  
                             </div>
                             <a class="btn btn-default tong3"> 统 计</a>
                        </div>
                        <div class="form-group">
                            <label  class="col-sm-2 control-label">学生人数</label>
                            <div class="col-sm-2">
                               <input type="text" class="form-control" name="baseset_studentnum" value="{%$baseset_data.baseset_studentnum%}" id="xue">  
                             </div>
                             <a class="btn btn-default tong4"> 统 计</a>
                        </div>
                        <!--后面添加-->
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">联系电话</label>
                          <div class="col-sm-6">
                            <input type="tel" class="form-control" name="baseset_tel" value="{%$baseset_data.baseset_tel%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">传真号码</label>
                          <div class="col-sm-6">
                            <input type="tel" class="form-control" name="baseset_fax" value="{%$baseset_data.baseset_fax%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">邮政编码</label>
                          <div class="col-sm-6">
                            <input type="text" class="form-control" name="baseset_postcode" value="{%$baseset_data.baseset_postcode%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">网址</label>
                          <div class="col-sm-6">
                            <input type="url" class="form-control" name="baseset_url" value="{%$baseset_data.baseset_url%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">电子邮箱</label>
                          <div class="col-sm-6">
                            <input type="email" class="form-control" name="baseset_email" value="{%$baseset_data.baseset_email%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">学生主要民族</label>
                          <div class="col-sm-6">
                            <input type="text" class="form-control" name="baseset_nation" value="{%$baseset_data.baseset_nation%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">占地面积</label>
                          <div class="col-sm-6">
                            <input type="text" class="form-control" name="baseset_usearea" value="{%$baseset_data.baseset_usearea%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">建筑面积</label>
                          <div class="col-sm-6">
                            <input type="text" class="form-control" name="baseset_buildarea" value="{%$baseset_data.baseset_buildarea%}">
                          </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">建校时间</label>
                          <div class="col-sm-6">
                            <input type="text" class="form-control" name="baseset_time" value="{%$baseset_data.baseset_time%}">
                          </div>
                        </div>
                        
                        <div class="form-group">
                          <label  class="col-sm-2 control-label">备注说明</label>
                          <div class="col-sm-6">
                            <textarea class="form-control" rows="3" name="baseset_content" value="{%$baseset_data.baseset_content%}"></textarea>
                          </div>
                        </div>
                         <div class="form-group">
                          <label  class="col-sm-2 control-label">学校地图</label>
                          <div class="col-sm-8">
                             <textarea class="form-control" rows="3" id="baseset_map" name="baseset_map" value="" ></textarea>
							 (http://api.map.baidu.com/lbsapi/creatmap/)
                          </div>
                        </div>
                  </div><!-- box-body -->
                  <div class="box-footer text-center">
					<input type="hidden" id="baseset_street" name="baseset_street" value="">
                    <button type="submit" class="btn btn-primary "  onClick="showAreaID()">保 存 信 息</button>
                  </div>
                  <!-- /.box-footer -->
                </form>
              </div>
           </div>
        </div><!--row-->
    </section>
 </div>
  <!--主要内容结束-->
{%include file="index.footer.tpl.php"%}
<script src="static/js/jquery.base64.js" type="text/javascript"></script>
<script src="static/js/Area.js" type="text/javascript"></script>
<script src="static/js/AreaData_min.js" type="text/javascript"></script>
<script type="text/javascript">

$(function (){
	initComplexArea('seachprov', 'seachcity', 'seachdistrict', area_array, sub_array, '{%$baseset_data.baseset_province%}', '{%$baseset_data.baseset_city%}', '{%$baseset_data.baseset_district%}');

	// 地图用js输出
	$.base64.utf8encode = true;
	$("#baseset_map").val( $.base64.decode('{%$baseset_data.baseset_map%}'));
});

//得到地区码
function getAreaID(){
	var area = 0;          
	if($("#seachdistrict").val() != "0"){
		area = $("#seachdistrict").val();                
	}else if ($("#seachcity").val() != "0"){
		area = $("#seachcity").val();
	}else{
		area = $("#seachprov").val();
	}
	return area;
}

function showAreaID() {
	//地区码
	var areaID = getAreaID();
	//地区名
	var areaName = getAreaNamebyID(areaID) ;
	$("#baseset_street").val(areaName);
	//alert("您选择的地区码：" + areaID + "      地区名：" + areaName);            
}

//根据地区码查询地区名
function getAreaNamebyID(areaID){
	var areaName = "";
	if(areaID.length == 2){
		areaName = area_array[areaID];
	}else if(areaID.length == 4){
		var index1 = areaID.substring(0, 2);
		areaName = area_array[index1] + "" + sub_array[index1][areaID];
	}else if(areaID.length == 6){
		var index1 = areaID.substring(0, 2);
		var index2 = areaID.substring(0, 4);
		areaName = area_array[index1] + "" + sub_array[index1][index2] + "" + sub_arr[index2][areaID];
	}
	return areaName;
}
</script>
  <script type="text/javascript">
        $(document).ready(function () {
            $('.tong1').click(function(){
			 //var str_data=$(this).closest('form').find('input').map(function(){
				//   return ($(this).attr("name")+'='+$(this).val());
			    //   }).get().join("&") ;
			//alert(str_data);
			$.ajax({
			  type: 'get',
			  url: 'index.php?a=baseset.countgrade',
			  data: { },
			  error:function(){
					alert('请求错误');
				},
			  success:function(data){
					//alert(data);
					$("#nian").val(data);
				}
        });
    });
	 $('.tong2').click(function(){
			$.ajax({
			  type: 'get',
			  url: 'index.php?a=baseset.countclass',
			  data: { },
			  error:function(){
					alert('请求错误');
				},
			  success:function(data){
					$("#ban").val(data);
				}
        });
    });
     
	 	 $('.tong3').click(function(){
			$.ajax({
			  type: 'get',
			  url: 'index.php?a=baseset.countstaff',
			  data: { },
			  error:function(){
					alert('请求错误');
				},
			  success:function(data){
					$("#jiao").val(data);
				}
        });
    });
	 $('.tong4').click(function(){
			$.ajax({
			  type: 'get',
			  url: 'index.php?a=baseset.countstudent',
			  data: { },
			  error:function(){
					alert('请求错误');
				},
			  success:function(data){
					$("#xue").val(data);
				}
        });
    });

 });
</script>


